<?php

namespace App\Http\Requests;

use App\Http\Requests\Request;

class UserAddRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {

        if(request()->isMethod('get')){
            return [
                //    规则为空
            ];
        }
        return [
            'username' => 'required|min:2|max:10',
            'password' => 'required|min:2|max:10',
            'email' => 'required|min:2|max:10|email',
            'phoneNumber' => 'required|min:2|max:10',
        ];
    }
    public function message()
    {
        return [
            'username' => '用户名不为空',
            'password' => '密码不能为空',
            'email' => '邮箱不能为空',
            'phoneNumber' => '电话号码不能为空',
        ];
    }
}
